blob: a9fe0f9635bbbae226af17a6d4abc824abccf6e3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import axios from "axios";
async function fetchData(id, number, provider, readId) {
try {
const { data } = await axios.get(
`https://api.anify.tv/pages?id=${id}&chapterNumber=${number}&providerId=${provider}&readId=${encodeURIComponent(
readId
)}`
);
if (!data) {
return null;
}
return data;
} catch (error) {
return null;
}
}
export default async function handler(req, res) {
const [id, number, provider, readId] = req.query.id;
try {
const data = await fetchData(id, number, provider, readId);
// if (!data) {
// return res.status(400).json({ error: "Invalid query" });
// }
return res.status(200).json(data);
} catch (error) {
return res.status(500).json({ error: error.message });
}
}
|